<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/webpage/common/taglibs.jspf"%>
<!DOCTYPE html>
<html>
<head>
    <title>设备描述</title>
    <meta name="decorator" content="form"/>
    <html:css name="bootstrap-fileinput" />
    <html:css name="simditor,jquery-select2" />
    <html:js name="jquery-select2"/>
</head>

<body class="white-bg"  formid="eqEquipDescForm">
    <form:form id="eqEquipDescForm" modelAttribute="data" action="${adminPath}/sbfb/eqequipdesc/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="useOrg"/>
		<form:hidden path="manageUnitId"/>
		<table  class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
		    <tbody>
				<tr>
					<td  class="width-15 active text-right">	
		              <label><font color="red">*</font>名称:</label>
		            </td>
					<td class="width-35">
						<form:input path="name" htmlEscape="false" class="form-control"  datatype="*"    />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label><font color="red">*</font>设备性质:</label>
		            </td>
					<td class="width-35">
						<form:input path="property" htmlEscape="false" class="form-control"  datatype="*"    />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label><font color="red">*</font>编码:</label>
		            </td>
					<td class="width-35">
						<form:input path="code" htmlEscape="false" class="form-control"  datatype="*"    />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label><font color="red">*</font>设备状态:</label>
		            </td>
					<td class="width-35">
						<form:input path="useStatus" htmlEscape="false" class="form-control"  datatype="*"    />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>规格型号:</label>
		            </td>
					<td class="width-35">
						<form:input path="specModel" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label>供应商:</label>
		            </td>
					<td class="width-35">
						<form:input path="supplier" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label><font color="red">*</font>管理单位:</label>
		            </td>
					<td class="width-35">
						<form:input path="manageUnit" htmlEscape="false" class="form-control"  datatype="*"    />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label>使用组织(所属项目):</label>
		            </td>
					<td class="width-35">
						<form:select path="useOrgCode" htmlEscape="false" class="form-control"        />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					
					<td  class="width-15 active text-right">	
		              <label>出厂日期:</label>
		            </td>
					<td class="width-35">
						<form:input path="dateManufacture" htmlEscape="false" class="form-control layer-date" placeholder="YYYY-MM-DD" onclick="laydate({istime: false, format: 'YYYY-MM-DD'})"       />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label>购入日期:</label>
		            </td>
					<td class="width-35">
						<form:input path="dateBuy" htmlEscape="false" class="form-control layer-date" placeholder="YYYY-MM-DD" onclick="laydate({istime: false, format: 'YYYY-MM-DD'})"       />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>进场时间:</label>
		            </td>
					<td class="width-35">
						<form:input path="dateInProject" htmlEscape="false" class="form-control layer-date" placeholder="YYYY-MM-DD" onclick="laydate({istime: false, format: 'YYYY-MM-DD'})"       />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label>购入单价:</label>
		            </td>
					<td class="width-35">
						<form:input path="price" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>入库日期:</label>
		            </td>
					<td class="width-35">
						<form:input path="dateInStorage" htmlEscape="false" class="form-control layer-date" placeholder="YYYY-MM-DD" onclick="laydate({istime: false, format: 'YYYY-MM-DD'})"       />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label>是否为施工设备:</label>
		            </td>
					<td class="width-35">
						<form:input path="isConstruction" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
				<tr>
					<td  class="width-15 active text-right">	
		              <label>是否为特种设备:</label>
		            </td>
					<td class="width-35" >
						<form:input path="isSpecial" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		            </td>
					<td class="width-35">
					</td>
				</tr>
		      
				<tr>
					<td  class="width-15 active text-right">	
		              <label><font color="red">*</font>设备来源:</label>
		            </td>
					<td class="width-35">
						<form:input path="source" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
					<td  class="width-15 active text-right">	
		              <label><font color="red">*</font>设备分类:</label>
		            </td>
					<td class="width-35">
						<form:input path="eqType" htmlEscape="false" class="form-control"      />
						<label class="Validform_checktip"></label>
					</td>
				</tr>
		   </tbody>
		</table>   
	</form:form>
<html:js name="bootstrap-fileinput" />
<html:js name="simditor" />

<script>
var useOrg="";
$(function() {
	getSelectuseOrg(); 
	
})


//绑定分公司
function getSelectuseOrg() {
	useOrg = $("#useOrg").val();
	$("#useOrgCode").change(function(){
		debugger
		$("#useOrg").val($("#useOrgCode").find("option:selected").text());
		console.log("useOrg:"+$("#useOrg").val());
	});
    $.ajax({
        type: "POST",
        url: "${adminPath}/sbfb/eqprojectinfo/ajaxList",
        data: {'page.size':100,queryFields:'code,name,'},
        dataType: "json",
        success: function (data) {
            var select = $("#useOrgCode");
        	
            select.empty();
        	if(data && data.total>0){            	
                var str = "<option value=''>请选择</option>";
                select.append(str);
                if (null != data && data.results.length > 0) {
                    $.each(data.results, function (i, item) {
                        if(useOrg && item.code==useOrg){
                            str = "<option value=" + item.code + " selected>" + item.name + "</option>";
                            select.append(str);
                            var event = document.createEvent("HTMLEvents");
                            event.initEvent("change", true, true);
                            document.querySelector("#useOrgCode").dispatchEvent(event);
                        }else{
                            str = "<option value=" + item.code + ">" + item.name + "</option>";
                            select.append(str);
                        }
                    });
                } else {
                    console.log("data is null");
                }
        	}

        }
    });
}


</script>
</body>
</html>